package cn.hg.solon.plugin.activerecord.demo.config;

import javax.sql.DataSource;

import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;

import com.zaxxer.hikari.HikariDataSource;

/**
 * 配置数据源
 */
@Configuration
public class Config {

    @Bean //不指定数据源名称，则采用默认数据源
    public DataSource db1(@Inject("${demo.db1}") HikariDataSource dataSource) {
        return dataSource;
    }

    @Bean("db2") //指定ActiveRecord数据源名称为db2
    public DataSource db2(@Inject("${demo.db2}") HikariDataSource dataSource) {
        return dataSource;
    }
}
